home *** CD-ROM | disk | FTP | other *** search
/ Scene 96 / Scene 96 International Edition (Zyklop Software) (Disc 2) (1997).iso / misc / coding / midas060 / src / midas.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-26  |  13.5 KB  |  411 lines

  1. /*      midas.h
  2.  *
  3.  * Simplified MIDAS Sound System API
  4.  *
  5.  * $Id: midas.h,v 1.15 1997/01/16 18:41:59 pekangas Exp $
  6.  *
  7.  * Copyright 1996,1997 Housemarque Inc.
  8.  *
  9.  * This file is part of the MIDAS Sound System, and may only be
  10.  * used, modified and distributed under the terms of the MIDAS
  11.  * Sound System license, LICENSE.TXT. By continuing to use,
  12.  * modify or distribute this file you indicate that you have
  13.  * read the license and understand and accept it fully.
  14. */
  15.  
  16. #ifndef __MIDAS_H
  17. #define __MIDAS_H
  18.  
  19.  
  20.  
  21. /****************************************************************************\
  22. *      NULL pointer definition (independence on library includes):
  23. \****************************************************************************/
  24.  
  25. #ifndef NULL
  26.     #define NULL 0L
  27. #endif
  28.  
  29.  
  30.  
  31. /****************************************************************************\
  32. *      MIDAS version defines
  33. \****************************************************************************/
  34.  
  35. #define MVERSION 0.6.0
  36. #define MVERSTR "0.6.0"
  37. #define MVERNUM 0x0600
  38.  
  39.  
  40.  
  41. /****************************************************************************\
  42. *      MIDAS header files:
  43. \****************************************************************************/
  44.  
  45. #include "lang.h"
  46. #include "mtypes.h"
  47. #include "errors.h"
  48. #include "mglobals.h"
  49. #include "mmem.h"
  50. #include "file.h"
  51. #include "sdevice.h"
  52. #include "gmplayer.h"
  53. #ifndef __LINUX__
  54. #include "timer.h"
  55. #include "dma.h"
  56. #endif
  57. #include "dsm.h"
  58. #include "mutils.h"
  59. #ifndef NOEMS
  60. #include "ems.h"
  61. #endif
  62. #if defined(__WIN32__)||defined(__LINUX__)
  63. #include "mpoll.h"
  64. #endif
  65. #include "midasfx.h"
  66. #include "midasstr.h"
  67.  
  68.  
  69.  
  70. #ifdef __cplusplus
  71. extern "C" {
  72. #endif
  73.  
  74.  
  75.  
  76. /****************************************************************************\
  77. *      MIDAS global variables:
  78. \****************************************************************************/
  79.  
  80. #ifdef __WIN32__
  81.  
  82. extern SoundDevice GLOBALVAR WinWave;   /* Windows Wave Sound Device */
  83. extern SoundDevice GLOBALVAR MixNoSound; /* Mixing NoSound SD */
  84. #define NUMSDEVICES 2                   /* total number of Sound Devices */
  85.  
  86. #else /* __WIN32__ */
  87.  
  88. #ifdef __LINUX__
  89.  
  90. extern SoundDevice GLOBALVAR OSS;   /* OSS Sound Device */
  91. #define NUMSDEVICES 1
  92.  
  93. #else /* __LINUX__ */
  94.  
  95. extern SoundDevice GLOBALVAR GUS;       /* Gravis UltraSound Sound Device */
  96. extern SoundDevice GLOBALVAR GDC;       /* Gravis UltraSound Mixing Device */
  97. extern SoundDevice GLOBALVAR PAS;       /* Pro Audio Spectrum Sound Device */
  98. extern SoundDevice GLOBALVAR WSS;       /* Windows Sound System Sound Device*/
  99. extern SoundDevice GLOBALVAR SB;        /* Sound Blaster Sound Device */
  100. extern SoundDevice GLOBALVAR NoSound;   /* No Sound Sound Device */
  101.  
  102. #define NUMSDEVICES 6                   /* total number of Sound Devices */
  103. #endif
  104. #endif
  105.  
  106. extern SoundDevice GLOBALVAR *midasSD;  /* current Sound Device */
  107.  
  108.     /* array to pointers to all Sound Devices, in numbering and detection
  109.        order - GUS is SD #1: */
  110. extern SoundDevice * GLOBALVAR midasSoundDevices[NUMSDEVICES];
  111.  
  112. extern gmpPlayHandle GLOBALVAR midasPlayHandle;  /* Generic Module Player
  113.                                                     playing handle */
  114. extern int GLOBALVAR midasDisableEMS;   /* 1 if EMS usage is disabled
  115.                                            (default 0) */
  116. extern int GLOBALVAR midasSDNumber;     /* Sound Device number (-1 for
  117.                                            autodetect, default -1) */
  118. extern int GLOBALVAR midasSDPort;       /* Sound Device I/O port number
  119.                                            (-1 for autodetect or SD default,
  120.                                            default -1) */
  121. extern int GLOBALVAR midasSDIRQ;        /* Sound Device IRQ number (-1 for
  122.                                            autodetect or SD default,
  123.                                            default -1) */
  124. extern int GLOBALVAR midasSDDMA;        /* Sound Device DMA channel number
  125.                                            (-1 for autodetect or SD default,
  126.                                            default -1) */
  127. extern int GLOBALVAR midasSDCard;       /* Sound Device sound card type
  128.                                            (-1 for autodetect or SD default,
  129.                                            default -1) */
  130. extern unsigned GLOBALVAR midasMixRate; /* Sound Device mixing rate */
  131. extern unsigned GLOBALVAR midasOutputMode; /* Sound Device output mode force
  132.                                            bits, default 0 (SD default) */
  133. extern int GLOBALVAR midasAmplification;  /* Forced amplification level or -1
  134.                                              for SD default (default -1) */
  135. extern int GLOBALVAR midasChannels;     /* number of channels open or 0 if no
  136.                                            channels have been opened using
  137.                                            midasOpenChannels() */
  138. extern int GLOBALVAR midasPlayerNum;    /* timer music player number */
  139.  
  140.  
  141. extern int GLOBALVAR midasEMSInit;      /* is EMS heap manager initialized? */
  142. extern int GLOBALVAR midasTMRInit;      /* is TempoTimer initialized? */
  143. extern int GLOBALVAR midasTMRPlay;      /* is sound beind player with timer?*/
  144. extern int GLOBALVAR midasSDInit;       /* is Sound Device initialized? */
  145. extern int GLOBALVAR midasSDChans;      /* are Sound Device channels open? */
  146. extern int GLOBALVAR midasGMPInit;      /* is GMP initialized? */
  147. extern int GLOBALVAR midasGMPPlay;      /* is GMP playing? */
  148. extern int GLOBALVAR midasTMRMusic;     /* is music being player with timer?*/
  149.  
  150. extern void (CALLING *midasErrorExit)(char *msg);   /* error exit function */
  151.  
  152.  
  153.  
  154.  
  155. /****************************************************************************\
  156. *      MIDAS constants:
  157. \****************************************************************************/
  158.  
  159.  
  160.  
  161. /****************************************************************************\
  162. *      MIDAS global functions from MIDAS.C:
  163. \****************************************************************************/
  164.  
  165.  
  166. /****************************************************************************\
  167. *
  168. * Function:     void midasError(int errNum)
  169. *
  170. * Description:  Prints a MIDAS error message to stderr and exits to DOS
  171. *
  172. * Input:        int errNum              MIDAS error code
  173. *
  174. \****************************************************************************/
  175.  
  176. void CALLING midasError(int errNum);
  177.  
  178.  
  179.  
  180.  
  181. /****************************************************************************\
  182. *
  183. * Function:     void midasUninitError(int errNum)
  184. *
  185. * Description:  Prints an error message to stderr and exits to DOS without
  186. *               uninitializing MIDAS. This function should only be used
  187. *               from midasClose();
  188. *
  189. * Input:        int errNum              MIDAS error code
  190. *
  191. \****************************************************************************/
  192.  
  193. void CALLING midasUninitError(int errNum);
  194.  
  195.  
  196.  
  197. /****************************************************************************\
  198. *
  199. * Function:     void midasDetectSD(void)
  200. *
  201. * Description:  Attempts to detect a Sound Device. Sets the global variable
  202. *               midasSD to point to the detected Sound Device or NULL if no
  203. *               Sound Device was detected
  204. *
  205. \****************************************************************************/
  206.  
  207. void CALLING midasDetectSD(void);
  208.  
  209.  
  210.  
  211. /****************************************************************************\
  212. *
  213. * Function:     void midasInit(void)
  214. *
  215. * Description:  Initializes MIDAS Sound System
  216. *
  217. \****************************************************************************/
  218.  
  219. void CALLING midasInit(void);
  220.  
  221.  
  222.  
  223. /****************************************************************************\
  224. *
  225. * Function:     void midasClose(void)
  226. *
  227. * Description:  Uninitializes MIDAS Sound System
  228. *
  229. \****************************************************************************/
  230.  
  231. void CALLING midasClose(void);
  232.  
  233.  
  234.  
  235. /****************************************************************************\
  236. *
  237. * Function:     void midasSetDefaults(void)
  238. *
  239. * Description:  Initializes MIDAS Sound System variables to their default
  240. *               states. MUST be the first MIDAS function to be called.
  241. *
  242. \****************************************************************************/
  243.  
  244. void CALLING midasSetDefaults(void);
  245.  
  246.  
  247.  
  248.  
  249. /****************************************************************************\
  250. *
  251. * Function:     void midasOpenChannels(int numChans);
  252. *
  253. * Description:  Opens Sound Device channels for sound and music output.
  254. *
  255. * Input:        int numChans            Number of channels to open
  256. *
  257. * Notes:        Channels opened with this function can be used for sound
  258. *               playing, and modules played with midasPlayModule() will be
  259. *               played through the last of these channels. This function is
  260. *               provided so that the same number of channels can be open
  261. *               the whole time throughout the execution of the program,
  262. *               keeping the volume level constant. Note that you must ensure
  263. *               that you open enough channels for all modules, otherwise
  264. *               midasPlayModule() will fail.
  265. *
  266. \****************************************************************************/
  267.  
  268. void CALLING midasOpenChannels(int numChans);
  269.  
  270.  
  271.  
  272.  
  273. /****************************************************************************\
  274. *
  275. * Function:     void midasCloseChannels(void);
  276. *
  277. * Description:  Closes Sound Device channels opened with midasOpenChannels().
  278. *               Do NOT call this function unless you have opened the sound
  279. *               channels used yourself with midasOpenChannels().
  280. *
  281. \****************************************************************************/
  282.  
  283. void CALLING midasCloseChannels(void);
  284.  
  285.  
  286.  
  287.  
  288. /****************************************************************************\
  289. *
  290. * Function:     midasPlayModule(gmpModule *module, int numEffectChns)
  291. *
  292. * Description:  Starts playing a Generic Module Player module loaded to memory
  293. *
  294. * Input:        gmpModule *module       Pointer to loaded module structure
  295. *               int numEffectChns       Number of channels to open for sound
  296. *                                       effects. Ignored if sound channels
  297. *                                       have already been opened with
  298. *                                       midasOpenChannels().
  299. *
  300. * Returns:      Pointer to module structure. This function can not fail,
  301. *               as it will call midasError() to handle all error cases.
  302. *
  303. * Notes:        The Sound Device channels available for sound effects are the
  304. *               _first_ numEffectChns channels. So, for example, if you use
  305. *               midasPlayModule(module, 3), you can use channels 0-2 for sound
  306. *               effects. If you already have opened channels with
  307. *               midasOpenChannels(), the module will be played with the last
  308. *               possible channels, so that the first channels will be
  309. *               available for sound effects. Note that if not enough channels
  310. *               are open this function will fail.
  311. *
  312. \****************************************************************************/
  313.  
  314. void CALLING midasPlayModule(gmpModule *module, int numEffectChns);
  315.  
  316.  
  317.  
  318.  
  319. /****************************************************************************\
  320. *
  321. * Function:     void midasStopModule(gmpModule *module)
  322. *
  323. * Input:        gmpModule *module       the module which is being played
  324. *
  325. * Description:  Stops playing a module and uninitializes the Module Player.
  326. *               If sound channels were NOT opened through midasOpenChannels(),
  327. *               but by letting midasPlayModule() open them, they will be
  328. *               closed. Sound channels opened with midasOpenChannels() are NOT
  329. *               closed and must be closed separately.
  330. *
  331. \****************************************************************************/
  332.  
  333. void CALLING midasStopModule(gmpModule *module);
  334.  
  335.  
  336.  
  337.  
  338. /****************************************************************************\
  339. *
  340. * Function:     void midasSetErrorExit(void (CALLING *errorExit)(char *msg))
  341. *
  342. * Description:  Sets error exit function.
  343. *
  344. * Input:        void (CALLING *errorExit)() Pointer to the function that will
  345. *                                           be called to exit the program with
  346. *                                           an error message.
  347. *
  348. \****************************************************************************/
  349.  
  350. void midasSetErrorExit(void (CALLING *midasErrorExit)(char *msg));
  351.  
  352.  
  353.  
  354.  
  355. #ifdef __cplusplus
  356. }
  357. #endif
  358.  
  359.  
  360. #endif
  361.  
  362.  
  363. /*
  364.  * $Log: midas.h,v $
  365.  * Revision 1.15  1997/01/16 18:41:59  pekangas
  366.  * Changed copyright messages to Housemarque
  367.  *
  368.  * Revision 1.14  1996/10/14 14:57:24  pekangas
  369.  * Changed version to 0.5.0
  370.  *
  371.  * Revision 1.13  1996/09/22 23:02:52  pekangas
  372.  * Now #include midasfx.h and midasstr.h
  373.  *
  374.  * Revision 1.12  1996/09/21 17:18:01  jpaana
  375.  * mpoll.h is included also in Linux
  376.  *
  377.  * Revision 1.11  1996/09/21 16:38:00  jpaana
  378.  * Changed uss to oss
  379.  *
  380.  * Revision 1.10  1996/09/08 20:21:20  pekangas
  381.  * Boosted version to RC2
  382.  *
  383.  * Revision 1.9  1996/08/06 20:35:51  pekangas
  384.  * Now #includes mpoll.h for WIN32 targets
  385.  *
  386.  * Revision 1.8  1996/08/06 18:45:25  pekangas
  387.  * Changed version number to 0.5.rc1
  388.  *
  389.  * Revision 1.7  1996/07/29 19:36:08  pekangas
  390.  * Added MixNoSound Sound Device for Win32
  391.  *
  392.  * Revision 1.6  1996/07/13 20:32:19  pekangas
  393.  * Fixed midasSoundDevices[] with Visual C
  394.  *
  395.  * Revision 1.5  1996/07/13 18:18:24  pekangas
  396.  * Fixed to compile with Visual C
  397.  *
  398.  * Revision 1.4  1996/06/05 19:40:35  jpaana
  399.  * Changed usswave to uss
  400.  *
  401.  * Revision 1.3  1996/05/25 15:49:57  jpaana
  402.  * Small fix
  403.  *
  404.  * Revision 1.2  1996/05/24 16:20:36  jpaana
  405.  * Added USSWave device and fixed Linux support
  406.  *
  407.  * Revision 1.1  1996/05/22 20:49:33  pekangas
  408.  * Initial revision
  409.  *
  410. */
  411.